package com.book.common.utils;

import com.book.book.NovelSiteEnum;
import com.book.book.service.BXWX9NovelSpider;
import com.book.book.service.DDXSNovelSpider;
import com.book.book.service.KSZNovelSpider;
import com.book.book.service.NovelSpider;

/***
 * @Author Lin
 * @Date Create By 14:22 2017/10/7
 * @Description 生产书籍列表的实现类
 */
public class NovelSpiderFactory {
    private NovelSpiderFactory() {
    }

    public static NovelSpider getNovelSpider(String url) {
        NovelSiteEnum novelSiteEnum = NovelSiteEnum.getEnumByUrl(url);
        switch (novelSiteEnum) {
            case KanShuZhong:
                return new KSZNovelSpider();
            case BiXiaWenXue9:
                return new BXWX9NovelSpider();
            case DingDianXiaoShuo:
                return new DDXSNovelSpider();
            default:
                throw new RuntimeException("不支持的小说抓取网站");
        }
    }
}
